package com.ads.tpgrupo4.server.xml;

import java.io.InputStream;

import org.w3c.dom.Document;

import com.ads.tpgrupo4.server.utils.XmlUtils;

public class InputStreamXmlSource implements XmlSource {

	final InputStream inputStream;
	
	public InputStreamXmlSource(final InputStream inputStream) {
		
		this.inputStream = inputStream;
	}
	
	@Override
	public Document getDocument() throws XmlSourceProcessingException {

		try {
			return XmlUtils.getDocumentFromInputStream(this.inputStream);
		} catch (final Exception e) {
			throw new XmlSourceProcessingException(e);
		}
	}

}
